1. Field of the Invention
The present invention relates to a semiconductor storage device such as a semiconductor disk device in which for example flash memory elements are installed and to a method of controlling this; in more detail, it relates to a semiconductor storage device and method of controlling it wherein degeneracy operation is performed if a memory element deteriorates.
2. Description of the Related Art
Conventionally, as semiconductor devices, semiconductor disk devices are known using for example flash memory. In such flash memory elements used in semiconductor disk devices, the bits may deteriorate with repeated reading and writing. When a bit has deteriorated in a flash memory element, reading and writing subsequent to that bit becomes impossible. As a result, a data error (i.e. the situation that write data and read data do not coincide) occurs on reading.
To deal with this, there is already known a technique called ECC (Error Correction Code) control; this constitutes a control technique whereby it is possible to detect whether or not data read from flash memory elements is correct. With this technique, it is possible to detect the occurrence of a data error when data is read from flash memory elements; furthermore, when a data error is detected, it is possible to determine whether this is a COR (Correctable Error i.e. a data error that can be corrected) or a UNC (Uncorrectable Error, i.e. a data error that cannot be corrected). And if the detected data error is a COR, this read data can be corrected.
In a conventional semiconductor disk device, when deterioration of a bit of a flash memory element was detected by ECC control, the sector to which this bit belonged was designated as "use forbidden", and it was arranged to employ an alternative sector provided beforehand in substitution for such a sector (hereinbelow called "deteriorated sector").
FIG. 12 is a block diagram showing conceptually an example of the layout of a conventional semiconductor disk device. Also, FIG. 13 is a flow chart given in explanation of the operation of such a semiconductor disk device.
Command information and address information that is input to disk controller 1220 from outside semiconductor disk device 1200 is sent, through host interface 1221 and micro CPU interface 1222, to a micro CPU (Central Processing Unit) 1231 within microcontroller section 1230 (S1301).
At this point, if this command information is a write command (S1302), micro CPU 1231 inputs main data that was input from outside to data buffer 1223 (S1303) through host interface 1221. Then, command information and address information from micro CPU 1231 and main data from data buffer 1223 are respectively sent to flash memory interface 1225 (S1304). Then, ECC control section 1226 generates ECC data by inputting main data from flash memory interface 1225 and sends this ECC data to flash memory interface 1225 (S1305). Serial data are then compiled (S1306) within this flash memory interface 1225.
FIG. 14 is a diagram showing the structure of serial data compiled within flash memory interface 1225. As shown in this Figure, this serial data consists for example of four bits of address information, for example eight bits of command information, for example 512 bytes of main data, and for example 11 bytes of ECC data.
Such serial data is output from flash memory interface 1225 and is input respectively in parallel to ten memory elements M(0).about.M(9) within flash memory section 1210. If the address information in this serial data corresponds to a sector within their own storage region, these memory elements M(0).about.M(9) write serial data to that sector (S1307).
FIG. 15 is a diagram showing the sector arrangement within memory elements M(0).about.M(9). As shown in this Figure, each memory element M(0).about.M(9) comprises m+1 sectors S(0).about.S(m). Thus, of the sectors S(0).about.S(m), the serial data referred to above is stored in the sector designated by the address information.
On the other hand, in step S1302, if the command information that is fetched into micro CPU 1231 is a read command, this micro CPU 1231 transfers address information to flash memory interface 1225 (S1308). Then, flash memory interface 1225 reads the serial data (S1309) stored in the sector corresponding to this address. ECC control section 1226 then reads the main data and ECC data in this serial data from flash memory interface 1225 and detects whether or not a data error has occurred (S1310). Then, if it detects that the COR type of data error has occurred, it corrects this error and sends this to flash memory interface 1225 (S1310). In contrast, if UNC is detected, micro CPU 1231 sets a flag (hereinbelow called "error flag") to indicate that the data is UNC. After this, under the control of data transfer control section 1224, data within flash memory interface 1225 (if COR has occurred, corrected data) is output to the outside of semiconductor disk device 1200 through data buffer 1223 and host interface 1221 (S1311).
Also, this semiconductor disk device 1200 deems a sector from which a data error (COR or UNC) has been detected more than a prescribed number of times to be a deteriorated sector. Then, in subsequent writing, instead of this deteriorated sector, it employs one or other of substitute sectors D(0).about.D(n) (see FIG. 15). When this happens, when use of a substitute sector D(0).about.D(m) has been decided upon, in a management information region 1501 (see FIG. 15), the address information of the substitute sector that is to be used in place of this deteriorated sector is stored (S1312) together with the address information of the deteriorated sector. By this means, if, in subsequent write processing, the address information that is input from outside to disk controller 1220 is the address of a deteriorated sector, serial data is written to the substitute sector corresponding to this deteriorated sector.
Thus, in a conventional semiconductor disk device 1200, reliability of the device was sought to be maintained by employing a substitute sector in place of a deteriorated sector if a deteriorated sector was generated.
However, in such a semiconductor disk device 1200, as described above, uncorrectable data errors (i.e. UNC) can occur, so, in cases where a large number of sectors in a single memory element deteriorate practically simultaneously, a large amount of data errors are generated simultaneously, resulting in data loss. This resulted in the drawback of the device reliability of a conventional semiconductor disk device 1200 being insufficient.
Also, in such a semiconductor disk device 1200, if the number of deteriorated sectors in any one memory element exceeded the number of substitute sectors, it became impossible to effect substitution in respect of a deteriorated sector; because of this, the entire element became unusable. Such a memory element was therefore subject to the drawback that the life of the element as a whole became very short, since even sectors that had not deteriorated became unusable.
Although the present description takes by way of example the case of a semiconductor disk device incorporating flash memory elements, such drawbacks can occur even in memory devices incorporating other types of memory elements, so long as these are subject to deterioration.